﻿@using QqhrCitizen.Models.ViewModel
@{
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
    vResourceLink link = ViewBag.ResourceLink as vResourceLink;
    ViewBag.Title = link.Title;
}


<div>
    <div class="result-title">
        <h1 class="head-tietle">@link.Title - 资源链接修改</h1>
    </div>
    @using (Html.BeginForm("LinkEdit", "Admin", new { ID = link.ID }, FormMethod.Post, new { enctype = "multipart/form-data",id="frmEditLink" }))
    {
        @Html.AntiForgerySID()
        <input type="hidden" name="ID" value="@link.ID" />
        <input type="hidden" name="FileID" value="@link.FileID" />
    <input type="hidden" value="@(link.IsHaveFile==false?"false":"true")" id="hdIsHaveFile" />
        <table class="detail-table">
            <tr>
                <td class="row-title">链接类型</td>
                <td>
                    <select name="LinkTypeID" class="textbox w-0-6" id="lsOneType">
                        <option value="">选择分类</option>
                        @foreach (var item in ViewBag.Types)
                        {
                            <option value="@item.ID" @(item.ID == link.LinkTypeID?"selected":"")>@item.TypeValue</option>
                        }
                    </select>
                </td>
            </tr>
            <tr>
            <tr>
                <td class="row-title">标题</td>
                <td>
                    <input class="textbox w-3" name="Title" type="text" value="@link.Title" />
                </td>
            </tr>
            <tr>
                <td class="row-title">
                    URL地址
                </td>
                <td>
                    <input type="text" name="URL" class="textbox w-3" value="@link.URL" />
                </td>
            </tr>
            <tr>
                <td class="row-title">
                    是否上传文件
                </td>
                <td>
                    <select name="IsHaveFile" id="slEditLink">
                        <option value="false" @(link.IsHaveFile==false?"selected":"")>否</option>
                        <option value="true" @(link.IsHaveFile==true? "selected" : "")>是</option>
                    </select>
                </td>
            </tr>
            @if (link.IsHaveFile)
            { 
             <tr>
                 <td class="row-title">资源文件</td>
                 <td>
                   @link.File.FileName
                 </td>
             </tr>
            }
            <tr>
                <td  class="row-title">
                    请选择文件:
                </td>
                <td>
                    <input type="file" name="file" id="fileEditLink" class="textbox nullable" />
                </td>
            </tr>
        </table>
        <p><input type="submit" value="保存" class="button blue" /></p>
    }
</div>


